var sqr = getCurrentDocument().getItemValueAsString("sqr");
var domainid = getDomainid();
var systemParam = getMainAndMiniSystemsInParam();
var result = getClauseSplitAditors(domainid, systemParam);
result = result + "," + sqr;
var targetList = getAuditorsFromStr(result, ",");
targetList;


/**
 * 讲字符串拼接的用户转换成list, 同时去重
 * @param {*} str 字符串
 * @param {*} conn 参数一的连接符
 */
function getAuditorsFromStr(str, conn) {
    var list = createObject("java.util.ArrayList");
    var set = createObject("java.util.HashSet");
    var array = splitText(str, conn);
    if (null != array && array.length > 0) {
        for (var i = 0; i < array.length; i++) {
            var user = array[i];
            if (isNotNull(user)) {
                set.add(user);
            }
        }
        if (set.size() > 0) {
            var iter = set.iterator();
            while (iter.hasNext()) {
                list.add(iter.next());
            }
        }
    }
    return list;
}


/**
 * 获取 条目拆分的审批人
 * @param {*} domainid 
 * @param {*} param 
 */
function getClauseSplitAditors(domainid, param) {
    var resultStr = "";
    sql = "SELECT replace(concat(" +
        " group_concat(item_qs),';', " +
        " group_concat(item_others), ';', " +
        " group_concat(item_mark2), ';', " +
        " group_concat(item_mark1), ';', " +
        " group_concat(item_info),';', " +
        " group_concat(item_dev),';', " +
        " group_concat(item_test),';', " +
        " group_concat(item_tech),';', " +
        " group_concat(item_oper) " +
        " ), ';', ',')  as item_data ,'" + domainid + "'  as domainid  from tlk_system_manager where " +
        "(case when (item_system_son is null or item_system_son = '')" +
        "then (item_system) else concat(item_system, '_', item_system_son) end ) " +
        "in ( '" + param + "' )";
    var result = findBySQL(sql);
    if (null != result) {
        resultStr = result.getItemValueAsString("data");
    }
    return resultStr;
}

/**
 * @returns 主配系统通过 “','” 符号连接的字符串
 */
function getMainAndMiniSystemsInParam() {
    var nameStr = "";
    var mainSys = getItemValueAsString("ztxt_mc"); //1. 获取主系统名称
    nameStr = nameStr + mainSys;
    var viceSysNameArray = splitText(getItemValueAsString("phxt_mc"), ";"); //2. 获取配合系统名称
    if ((null != viceSysNameArray) && (viceSysNameArray.length > 0)) { //3. 整合
        for (var i = 0; i < viceSysNameArray.length; i++) {
            nameStr += "','" + viceSysNameArray[i];
        }
    }
    var param = nameStr;
    return param;
}